package com.ruoyi.web.controller.system;

import java.util.List;
import javax.servlet.http.HttpServletResponse;

import com.ruoyi.common.core.domain.entity.AiDeepseekAnswerTotal;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.service.IAiDeepseekAnswerTotalService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * ai对录音段落的总结---总的Controller
 *
 * @author ruoyi
 * @date 2025-03-12
 */
@RestController
@RequestMapping("/system/total")
public class AiDeepseekAnswerTotalController extends BaseController
{
    @Autowired
    private IAiDeepseekAnswerTotalService aiDeepseekAnswerTotalService;

    /**
     * 查询ai对录音段落的总结---总的列表
     */
//    @PreAuthorize("@ss.hasPermi('system:total:list')")
    @GetMapping("/list")
    public TableDataInfo list(AiDeepseekAnswerTotal aiDeepseekAnswerTotal)
    {
        startPage();
        List<AiDeepseekAnswerTotal> list = aiDeepseekAnswerTotalService.selectAiDeepseekAnswerTotalList(aiDeepseekAnswerTotal);
        return getDataTable(list);
    }

    /**
     * 导出ai对录音段落的总结---总的列表
     */
    @PreAuthorize("@ss.hasPermi('system:total:export')")
    @Log(title = "ai对录音段落的总结---总的", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, AiDeepseekAnswerTotal aiDeepseekAnswerTotal)
    {
        List<AiDeepseekAnswerTotal> list = aiDeepseekAnswerTotalService.selectAiDeepseekAnswerTotalList(aiDeepseekAnswerTotal);
        ExcelUtil<AiDeepseekAnswerTotal> util = new ExcelUtil<AiDeepseekAnswerTotal>(AiDeepseekAnswerTotal.class);
        util.exportExcel(response, list, "ai对录音段落的总结---总的数据");
    }

    /**
     * 获取ai对录音段落的总结---总的详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:total:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(aiDeepseekAnswerTotalService.selectAiDeepseekAnswerTotalById(id));
    }

    /**
     * 新增ai对录音段落的总结---总的
     */
    @PreAuthorize("@ss.hasPermi('system:total:add')")
    @Log(title = "ai对录音段落的总结---总的", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody AiDeepseekAnswerTotal aiDeepseekAnswerTotal)
    {
        return toAjax(aiDeepseekAnswerTotalService.insertAiDeepseekAnswerTotal(aiDeepseekAnswerTotal));
    }

    /**
     * 修改ai对录音段落的总结---总的
     */
    @PreAuthorize("@ss.hasPermi('system:total:edit')")
    @Log(title = "ai对录音段落的总结---总的", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody AiDeepseekAnswerTotal aiDeepseekAnswerTotal)
    {
        return toAjax(aiDeepseekAnswerTotalService.updateAiDeepseekAnswerTotal(aiDeepseekAnswerTotal));
    }

    /**
     * 删除ai对录音段落的总结---总的
     */
    @PreAuthorize("@ss.hasPermi('system:total:remove')")
    @Log(title = "ai对录音段落的总结---总的", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(aiDeepseekAnswerTotalService.deleteAiDeepseekAnswerTotalByIds(ids));
    }
}
